﻿using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour 
{
	public float m_Speed;
	public GameObject m_Laser;
	
	void Start () 
	{
		
	}
	
	
	void Update () 
	{
		MovementDirection();
		if (Input.GetButtonDown("Fire1")) 
		{
			
			Instantiate(m_Laser, transform.position, transform.rotation);
			
		}
	}
	
	void MovementDirection()
	{
		if(Input.GetKey(KeyCode.UpArrow))
		{
			transform.position += new Vector3(0, 0, m_Speed*Time.deltaTime);
		}
		
		if(Input.GetKey(KeyCode.DownArrow))
		{
			transform.position -= new Vector3(0, 0, m_Speed*Time.deltaTime);
		}
		
		if(Input.GetKey(KeyCode.LeftArrow))
		{
			transform.position -= new Vector3(m_Speed*Time.deltaTime, 0, 0);
		}
		if(Input.GetKey(KeyCode.RightArrow))
		{
			transform.position += new Vector3(m_Speed*Time.deltaTime, 0, 0);
		}
	}
	
}
